home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
World of Video
/
World of Video.iso
/
gfxprograms
/
3dprograms
/
rayshade-4.0
/
fixes
/
fix013
< prev
next >
Wrap
Internet Message Format
|
1995-02-13
|
4KB
From theseas!nfotis Sat, 10 Jul 93 01:37:32 EET
Received: by kriton.UUCP (V1.16/Amiga)
id AA00000; Sat, 10 Jul 93 01:37:32 EET
Received: by theseas.ntua.gr; Fri, 9 Jul 93 21:50:54 +0300
Received: by icaros.ntua.gr ; Fri, 9 Jul 93 21:49:20 +0300
Message-Id: <9307091849.AA06850@icaros.ntua.gr>
Date: Fri, 9 Jul 1993 21:49:19 +0300 (EET DST)
X-Mailer: ELM [version 2.4 PL21]
Mime-Version: 1.0
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: 7bit
Content-Length: 3594
From: Nick C. Fotis <theseas.ntua.gr!nfotis>
To: theseas!kyrimis (Kr. Kyrimis)
Subject: Re: hf's inside csg's problem (fwd)
Forwarded message:
From halt@dsd.es.com Fri Jul 9 01:42:06 1993
Errors-To: core-owner%itchy@dsd.es.com
Errors-To: core-owner%itchy@dsd.es.com
Date: Thu, 8 Jul 93 13:05:19 -0700
Message-Id: <9307082005.AA14560@itchy>
Errors-To: core-owner%itchy@dsd.es.com
Reply-To: core@dsd.es.com (TraceCore Mailing List)
From: Craig Kolb <cek@princeton.edu>
Subject: Re: hf's inside csg's problem
List-Name: tracecore
Precedence: Bulk
Apparently-To: nfotis@theseas.ntua.gr
> I've been trying to figure out the problem that was brought up
> about using heightfields in CSG objects.
> [...]
> What appears to be happening
> is that mindist is being passed in as 2.09878, the call to OutOfBounds()
> fails and hitpos is being set back equal to ray->pos resulting in hitpos.y
> being negative [...]
This is a bug in 4.0.6 -- see the attached bugfix. In short, the
entire "else" clause in the HF bbox test is bogus. Nuke it.
>A few questions -- What is the actual purpose of mindist? I was
>under the impression that it was a "fudge" factor to keep rays being fired
>off an object from hitting that object again (due to round off errors). With
>CSG objects, is mindist supposed to help narrow the range being searched
>(i.e. only look for the objects between mindist and maxdist rather than
>from 0 (or EPSILON) to maxdist (since there is something closer at mindist??)).
Yup, exactly. The intersection routines are supposed to return the
closest intersection betwheen "mindist" and "maxdist" along the ray
Craig
---
I've discovered a bug in rayshade's heightfield rendering code.
This bug could cause rayshade to dump core, especially when
rendering transparent height fields or heightfields that
cast "long" shadows.
The fix will appear in the next release. If you wish to fix
the bug before then, edit libray/libobj/hf.c. Lines 202-214 read:
/*
* Find where we hit the hf cube.
*/
VecAddScaled(ray->pos, mindist, ray->dir, &hitpos);
if (OutOfBounds(&hitpos, hf->boundbox)) {
offset = *maxdist;
if (!BoundsIntersect(ray, hf->boundbox, mindist, &offset))
return FALSE;
hitpos.x = ray->pos.x + ray->dir.x * offset;
hitpos.y = ray->pos.y + ray->dir.y * offset;
hitpos.z = ray->pos.z + ray->dir.z * offset;
} else
hitpos = ray->pos;
To fix the bug, remove the "else" case entirely, to make the
block of code read:
/*
* Find where we hit the hf cube.
*/
VecAddScaled(ray->pos, mindist, ray->dir, &hitpos);
if (OutOfBounds(&hitpos, hf->boundbox)) {
offset = *maxdist;
if (!BoundsIntersect(ray, hf->boundbox, mindist, &offset))
return FALSE;
hitpos.x = ray->pos.x + ray->dir.x * offset;
hitpos.y = ray->pos.y + ray->dir.y * offset;
hitpos.z = ray->pos.z + ray->dir.z * offset;
}
Run "make", making sure that rayshade (and raypaint, if appropriate)
are re-linked, and you should be all set.
--
Nick (Nikolaos) Fotis National Technical Univ. of Athens, Greece
HOME: 16 Esperidon St., InterNet : nfotis@theseas.ntua.gr
Halandri, GR - 152 32 UUCP: mcsun!pythia!theseas!nfotis
Athens, GREECE FAX: (+30 1) 77 84 578
USENET Editor of comp.graphics Resource Listing and soc.culture.greece FAQ
NTUA/UA ACM Student Chapter Chair - we're organizing a small conference
in Comp. Graphics, call if you're interested to participate.